Minimaps et al.

I’m working on a program. I’m building everything on classes so that they act like little pieces that can be incorporated into other programs.

I want to make simple classes that other programers can add to their programs much like the Steer behaviors that chombee is working on.

I developed a minimap for my program and am in the process of making it so that it is completely independent of the program I am currently writing.

Just want to know if there is any interest in this sort of thing. Currently it can track in real time any nodepath. I rotates with the heading of the camera so the map is always oriented correctly.

Here’s some screen shots.

http://links.pictures.aol.com/pic?id=17b05sXZmi70bn0mpLIfWFxFiggTtfJofPDBAQ0XH9j35R0=&size=l

links.pictures.aol.com/pic?id=17 … h0=&size=l

links.pictures.aol.com/pic?id=17 … Pc=&size=l

links.pictures.aol.com/pic?id=17 … nM=&size=l

Sorry, I’m having trouble getting the images to show up. I trust most of you will be able to figure out how to see them.

Very cool! I could see myself using such a class in a game.

Looks nice!
Is it fast?

I hope to get the code up here soon. Like I said the hold up right now is that the class was built for my program, I want it to be as user-friendly and easy to understand as possible.

As far as fast, I notice no change whatsoever in the frame rate with it on or off. The actual processing (the process that must be called each frame) algorithm is very simple but it uses some mathematical hacks to accurately display the information.

Setting it up should be easy for the user. The map can build on default values but if the user wants to they can change the location on the screen, the size, whether or not the map as a whole rotates with the camera, the position of the center of the world, the back ground image on the map, the image used for the tracked objects, etc. etc.

Right now I’m trying to think about how I want the user to define multiple types of tracked objects: for example if the user wanted red dots for team1 and blue dots for team2, yellow triangles for collectables, etc. In this situation the minimap needs to know which populations of nodepaths belong to which category.

Looks very nice. Can you provide a demo?

Also how are you making the terrain and can you mix textures in it? Something like this: A bottom ground texture + B alpha mask + C top texture for road or grass.

That looks awesome! I would be very interested in checking it out, if you released the code I think I’d very likely try to integrate it with my steering behaviours code to put together a game.

I’d love to get my hands on the code that is generating that terrain and doing the texturing, sky, water, trees. The little map thing in the corner looks awesome too. Where are you getting those bird models from?

The only reason I didn’t bother to implement a flocking steering behaviour that could simulate birds was that I didn’t have access to a nice animated bird model to use with it. Well, that and I don’t technically need it. But the steering behaviours could be extended just a little to add flocking and that’d work very nicely with those birds and your terrain…

The next thing I was going to work on after finishing steering behaviours was throwing together a nice scene to put the characters in. Looks like you might have beaten me to it :slight_smile: I really look forward to seeing the code.

I can understand that you want to get the code right and make it reusable before you release it, that is definitely the right approach. But also remember that if you are making open source code for others to use and contribute to, a good rule of thumb is “release early, release often.” Witness the amount of suggestions and code contributions I got on this forum for the steering behaviours. The code now is much better than it was when I first put it up. Whenever someone made a contribution, I tried to incorporate it and update the code as quick as I could to encourage more, and it seemed to work.

Anyway, amazing work, and thanks in advance for releasing this, I think it will be a very valuable contribution.

Ok, Chombee convinced me. I’m releasing early.

I’m still working through some problems with the minimap class but at least you’ll get a working version here.

There are two separate versions.

Island.py = you can tour the island and look at the animals using keyboard for navigation. It uses Chombee’s camera. Use arrow keys to navigate, ASDW for direction.

joystickversion.py = The newer joystick version. You’ll need a copy of Pygame on your machine somewhere plus a joystick. This is the funner version, lets you fly around on the back of one of the birds. And shoot non-colliding blue missles (don’t ask me why, I was just testing)

Also, I don’t have a good place to put the files, if anyone can help me host that would be great. For now they are on my wife’s website:

galvestonharpist.com/Software/Minimap.zip

I figured a .zip would be easiest. Feel free to use any of the models, I made them all myself, with the exception of the skybox, even that I edited heavily.

Expect more soon.

Great! I’m away from my game-capable PC until next week, but will try this stuff out as soon as I can.

@mavasher: You can have some space on panda3dprojects.com. PM Bigfoot29 about this.

Good idea pro-rsoft, I hadn’t thought about that. I PM’d Bigfoot29 and hope to hear back soon.

mavasher, Beautiful work!

Thanks for releasing an early version to check out. I am very impressed…keep it up

Thanks, Liquid7800,

I’m glad you got it to work. I’ve added support for multiple teams to be represented on the minimap.

I’m still having trouble getting the distance variables to be universal, I got my current values from trial and error and still don’t know how to calculate them.

The File comes with all the other classes that I’ve been working on: There are two “guides” a 2D and 3D version, like steering vehicles the guides turn toward or away based on behavior. They are similar to chombee’s vehicles but they are not as well developed- they are based on turning about an axis instead of vector addition like in the vehicles.

The island class creates the terrain, and allows it to be painted. I’ve still got a lot to do on this.

If you press the “r” key you should be able to cycle through lighting for different times of day, Daytime, Twillight, Sunrise.

Excellent work, mavasher.

One thing: i noticed that the red dots on the map are sometimes out of the circle.
To check whether something is within a circle, try:

import math
if(math.sqrt(math.sqr(pos_of_bird)+math.sqr(middle_of_circle))>circle_radius):
  # do not draw then

EDIT:
Another thing: It can’t load the tree texture here. The texture is missing OR you are using an absolute path in your .egg file.

Yeah, I know the minimap had some problems. I’ve already made a lot of improvements, and still have some work to do.

As far as the tree texture, I was worried about that. You’re right, the .egg file points to an absolute path. I’m still not sure why as I made the model in blender and exported it but that’s what happened.

I’m writing a lot of AI scripting right now for my program but I’ll release some improved code for the minimap soon.

I have finals this week so it may be a little slow.

Also, I developed a Radar class. It looks a lot like the Minimap except that its a radar with the camera’s y-axis as the center. I have it set in my program as a front radar and rear radar so I can see nodepaths around me.

mavasher, I found a bug.
I can’t put any characters at excact the position 0,0 because of that ‘hack’ of yours. (zero division error, 1/0), it will crash:

Traceback (most recent call last):
  File "/home/pro-rsoft/docs/Programmeren/Programs/heartseed/trunk/main/src/main.py", line 89, in ?
    run()
  File "debtmp/usr/share/panda3d/direct/src/showbase/ShowBase.py", line 2028, in run
  File "debtmp/usr/share/panda3d/direct/src/task/Task.py", line 839, in run
  File "debtmp/usr/share/panda3d/direct/src/task/Task.py", line 787, in step
  File "debtmp/usr/share/panda3d/direct/src/task/Task.py", line 721, in __stepThroughList
  File "debtmp/usr/share/panda3d/direct/src/task/Task.py", line 644, in __executeTask
  File "/home/pro-rsoft/docs/Programmeren/Programs/heartseed/trunk/main/src/minimap.py", line 88, in step
    self.dots[team][i].setScale((1/x)*4)	#the dots representing targets should be 4x4 pixels. (the 1/x) is a necessary hack, don't worry about it.  
ZeroDivisionError: float division

It works fine though If I slightly change the starting position of my avatar.

Good call,

I’ll fix it. thanks.

Update:

I’m done with finals, and but have my schedule changing quite a bit, we’ll see what I can get done.

I updated some files- added support for multiple “teams”, fixed some style problems as per chombee’s advice.

I fixed the texture problem on the tree file. Sorry about that.

use the link above to download the files.

I’m not working very much on this right now. I’m writing a lot for the space game I posted about.

New download doesn’t contain island.py? Only the minimap?

chombee, that’s right - you need to download the first one first, then overwrite the first one with the second one.

Sorry about this guys. I messed up. I’m working on a lot of stuff at once.

The file there now should work.

Expect a lot more soon.