JGE++ question

Anything related to the PSP (homebrews, plugins, hacking, news,...) can go here
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: JGE++ question

Post by wololo »

This is because of bilinear filtering. If you know you will never scale your quads, I suggest you deactivate bilinear filtering in JGE (I believe you can call a function to do that, can't remember the name).

If you need to scale your textures, then bilinear filtering is suggested. In that case, either load the textures with 1 pixel less than what they are on top and left (or is it bottom and right ?).
For example, if your texture is 32x32, your quad should look like:
(0,0,31,31) instead of (0,0,32,32).

(or (1,1,31,31), I'm not sure anymore...
furiousone
Posts: 61
Joined: Sat Oct 31, 2009 10:30 pm

Re: JGE++ question

Post by furiousone »

I think 1,1,31,31. I'll just disable bilinear filtering I guess cause I dont really need to scale them (so far at least I dont need to).

Here's a screenshot btw, if you are curious :)
http://img704.imageshack.us/img704/5899 ... shotdk.png

Thanks, turning off filtering helps!
Here's the function call in case you are interested:
renderer->EnableTextureFilter(false);
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: JGE++ question

Post by wololo »

It's looking good! I would love to play HOMM on the PSP :mrgreen:
furiousone
Posts: 61
Joined: Sat Oct 31, 2009 10:30 pm

Re: JGE++ question

Post by furiousone »

Finally, after almost 2 month of break from writing the code(was too busy at work and school), I spent the day today to create some simple pathfinding logic. Works pretty good actually :) Take a look.
http://www.megaupload.com/?d=DYGU0TGX
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: JGE++ question

Post by wololo »

Nice progress, this looks good :)
Psyringe
Posts: 1163
Joined: Mon Aug 31, 2009 10:53 am

Re: JGE++ question

Post by Psyringe »

Glad to see that you're still working on this one. :)
furiousone
Posts: 61
Joined: Sat Oct 31, 2009 10:30 pm

Re: JGE++ question

Post by furiousone »

Yeah, too bad I have so little time lately. Because I've got a lot of things I want to work on, like map editor, AI, castles, and all the other good stuff. I guess I'll have more time when I get done with my masters in the end of April.
furiousone
Posts: 61
Joined: Sat Oct 31, 2009 10:30 pm

Re: JGE++ question

Post by furiousone »

A new demo video, guys! I guess I can already call this version 0.01.
Some new features:

- AI! (Very simple one so far, it just finds a random "clickable" object on the map and runs to it)
- Multiple heroes for AI and Player
- Switch between heroes by pressing a Square button
- Dynamically calculated path based on the amount of obstacles present (if you switch between your heroes, move one of them out of the way to the target, and switch back, a new path will be calculated)
- Treasure chests are now collectible for gold or experience
- Objects disappear from the map, once collected by Player
- Main menu (So far only one option - exit game by pressing X)

http://www.megaupload.com/?d=SDEGOTXL
furiousone
Posts: 61
Joined: Sat Oct 31, 2009 10:30 pm

Re: JGE++ question

Post by furiousone »

An actual question for you guys:

I have a 2-d array of pointers to objects:

Code: Select all

MapObj *MapObjects[MapWidth][MapHeight]; 

where MapObj is the base class for the objects on the map. Now, I also have some derived classes (MapObjTest, for example) and some of the MapObjects are pointers to objects of this type. For example,

Code: Select all

MapObjects[0][0] = new MapObjTest(IMPASS,"knight_castle_bot4",0,0,5);
This derived class has a method ReturnVar that I'd like to call (not part of the base class), which returns an int. Is there any other way to do this other than:

Code: Select all

x = dynamic_cast<MapObjTest*>(MapObjects[0][0])->ReturnVar();
Am I even doing this right at all? It seems to work, but I'm not sure if i can assign pointers to class MapObjTest to pointers of type MapObj without consequences.
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: JGE++ question

Post by wololo »

Basically if you have an array of objects and that all these objects don't share the same method names I would start by questioning the design (Wagic has lots of such bad code, by the way). Maybe the method should be in the base class (virtual, of course) and do nothing in the default parent class ?

Code: Select all

x = dynamic_cast<MapObjTest*>(MapObjects[0][0])->ReturnVar();
You need to test that the dynamic cast didn't return null first.
Locked